package main.war.listener;

import java.util.HashMap;

import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;

public class PlayerInteract implements Listener{
	private ItemStack item;
	private final HashMap<Player,Location> LocA = new HashMap<>();
	private final HashMap<Player,Location> LocB = new HashMap<>();
	public PlayerInteract(ItemStack item){
		this.item = item;
	}
	@EventHandler
	public void onInteract(PlayerInteractEvent event){
		if(event.getItem()==null&&!(event.hasBlock())&&!(this.item.equals(event.getItem())))return;
		if(event.getAction()==Action.LEFT_CLICK_BLOCK){
			LocA.put(event.getPlayer(), event.getClickedBlock().getLocation());
		}else if(event.getAction()==Action.RIGHT_CLICK_BLOCK){
			LocB.put(event.getPlayer(), event.getClickedBlock().getLocation());
		}
	}

}
